package com.dzx.currentency.testController;

import com.dzx.currentency.entity.UserEntity;
import com.dzx.currentency.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author DuanZhaoXu
 * @ClassName:
 * @Description:
 * @date 2018年11月22日 09:22:24
 */
@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {


    @Autowired
    private UserService userService;

    @GetMapping("/findById/{id}")
    public UserEntity findById(@PathVariable Integer id) {
        return userService.queryById(id);
    }


    @GetMapping("/findByName/{name}")
    public UserEntity findByName(@PathVariable String name) {
        return userService.queryByName(name);
    }

    @PostMapping("/insertUser")
    public  int  insertUser(UserEntity userEntity){
        return  userService.insertUser(userEntity);
    }
}
